﻿using UnityEngine.Events;

namespace Anderson.PluginFramework
{
    public enum PluginEventType
    {
        /// <summary>
        /// 未解析成功
        /// </summary>
        UnResolve,
        /// <summary>
        /// 解析成功
        /// </summary>
        Resolved,
        /// <summary>
        /// 启动中
        /// </summary>
        Starting,
        /// <summary>
        /// 启动完成
        /// </summary>
        Started,
        /// <summary>
        /// 停止中
        /// </summary>
        Stopping,
        /// <summary>
        /// 停止完成
        /// </summary>
        Stopped
    }

    public class PluginEventArg
    {
        private PluginEventType m_state;
        private IPlugin m_plugin;

        public PluginEventType State
        {
            get
            {
                return m_state;
            }

            set
            {
                m_state = value;
            }
        }

        public IPlugin Plugin
        {
            get
            {
                return m_plugin;
            }

            set
            {
                m_plugin = value;
            }
        }

        public PluginEventArg(PluginEventType state, IPlugin plugin)
        {
            m_state = state;
            m_plugin = plugin;
        }
    }

    [System.Serializable]
    public class PluginEvent : UnityEvent<PluginEventArg>
    {
    }
}
